<layout name="layout" />
<div class="pageheader notab">
	<!--<h1 class="pagetitle" id="campaign_title"><a href="/">更新数据</a></h1>-->
	<h1 class="pagetitle">
		<a href="/" class="linkWay">首页/其他工具</a>
		&nbsp;<span class="divider">»</span>&nbsp;
		<a href="#" class="currentWay">数据更新</a>
	</h1>
	<!--<ul class="breadcrumbs breadcrumbs2">
		<li>更新直通车相关的各项数据</li>
	</ul>-->
</div>
<div id="contentwrapper" class="contentwrapper nopadding">
	<div style="width:100%" >
		<h5 style="margin: 20px 0 9px">分类更新</h5>
		<table cellspacing="0" cellpadding="0" border="0" class="metrotable healthtable">
			<thead>
			<tr>
				<th>类别</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			<tr>
				<td>
					更新计划
				</td>
				<td>
					<a class="actionBtn" href="javascript:;" rel="campaign">更新</a>
				</td>
			</tr>
			<tr>
				<td>
					更新推广组
				</td>
				<td>
					<a class="actionBtn" href="javascript:;" rel="adgroup">更新</a>
				</td>
			</tr>
			<tr>
				<td>
					更新产品（在售宝贝）
				</td>
				<td>
					<a class="actionBtn" href="javascript:;" rel="products">更新</a>
				</td>
			</tr>
			<tr>
				<td>
					更新报表数据
				</td>
				<td>
					<a class="actionBtn" href="javascript:;" rel="rpt">更新</a>
				</td>
			</tr>
			</tbody>
		</table>
	</div>
	<div id="tabs">
		<div class="tabs_header" >
			<a class="syn_all actionBtn left" style="margin-left:940px;" href="javascript:;" rel="all">更新所有数据</a>
		</div>
	</div>
</div>
<script type="text/javascript">
	(function($) {
		$("table").on('click', '.actionBtn', function(){
			var $this = $(this),
					rel = $this.attr('rel');
			$this.text('正在更新……');

			wt.get('/synchronize/update', {rel : rel}, function(data) {
				data = $.parseJSON(data);
				if(data.data === 1) {
					$this.text('更新成功');
				} else {
					$this.text('更新失败');
				}
			})
		})

		$(".syn_all").click(function() {
			$('table .actionBtn').click();
		})
	})(jQuery);
</script>